#ifndef HIPOPT_H__
#define HIPOPT_H__

/* hipopt.c
 * This file is part of hipopt 
 * hipopt is a simple command line arguments parser C library.
 * 
 * Copyright (C) 2008 - Pablo Rauzy
 * 
 * hipopt is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * hipopt is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 */

typedef struct hipopt_ {
  char *name;
  char *value;
  int index; /* in argv */
} Hipopt;

typedef struct hipopts_ {
  int count;
  Hipopt **opts;
  int lastopt; /* index in argv of the last option */
} Hipopts;

/* private: */
/* used in hopt_init() */
int         hopt_countargs  (char *args[]);
Hipopt *    hopt_newopt     (const char arg, int idx);
Hipopt *    hopt_newlongopt (const char *arg, int idx);
Hipopt *    hopt_setvalue   (Hipopt *opt, char *arg);

/* public: */
Hipopts *   hopt_init       (char *argv[]);
int         hopt_count      (Hipopts *options);
char *      hopt_get        (const char *opt_name, Hipopts *options);
char *      hopt_getn       (int opt_num, Hipopts *options);
int         hopt_indexof    (const char *opt_name, Hipopts *options);
int         hopt_isset      (const char *opt_name, Hipopts *options);
int         hopt_lastopt    (Hipopts *options);
void        hopt_free       (Hipopts *options);

#endif

